package com.etc.controller;

import javax.annotation.Resource;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.etc.entity.Manager;
import com.etc.service.ManagerService;

@Controller
public class ManagerController {

	@Resource
	private ManagerService managerService;
	
	@RequestMapping(value="getManager")
	@ResponseBody
	public String selectByPrimaryKey(int managerid,String managerpwd , HttpServletRequest request) {
		Manager manager = managerService.selectByPrimaryKey(managerid,managerpwd);
		request.getSession().setAttribute("manager", manager);
		if(manager!=null) {
		return "success";
		}
		return "false";
	}
	
	@RequestMapping(value="removeManager")
	public String remove(HttpServletRequest request) {
		request.getSession().removeAttribute("manager");
		return "redirect:/back/login.jsp";
	}
}
